

// const db = await JSONFilePreset('db.json', { posts: [] }); 

const low =   require('lowdb');
const FileSync = require('lowdb/adapters/FileSync');

const adapter = new FileSync('db.json');
const  db = low(adapter);

// db.defaults({ports:[],user:[]}).write();

// db.get('ports').push({"title":"雅阁","type":"支出"}).write();

// db.set('user.name','提莫').write();

// db.get('ports').find({'title':'雅阁'}).assign({'id':1}).write();

// db.get('ports').remove({"title":"雅阁"}).write();

console.log(db.has('ports').value());
console.log(db.get('ports').value());
console.log(db.get('ports').find({'id':1}).value());


